/*
 * Start.java
 *
 * Created on May 7, 2006, 4:17 PM
 */

package poppitplayer.gui;

import javax.swing.*;
import java.awt.*;
import java.util.*;
import simpoppit.gameboard.*;

/**
 *
 * @author  Andrew
 */
public class Start extends javax.swing.JFrame {
    
    /** Creates new form Start */
    public Start() {
        
        initComponents();
        
        //Toolkit kit = Toolkit.getDefaultToolkit();
        //Dimension screensize = kit.getScreenSize();

        //Container contentPane = getContentPane();

        //setSize(screensize.width / 2, screensize.height / 2);
        //setLocation(screensize.width / 4, screensize.height / 4);
        //Image img = kit.getImage("icon.png");
        //setIconImage(img);
        
    }
    
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
    private void initComponents() {
        jButtonMePlay = new javax.swing.JButton();
        jButtonComputerPlay = new javax.swing.JButton();
        jButtonMeVSComputer = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("Poppit Player");
        setName("startframe");
        setResizable(false);
        jButtonMePlay.setText("Play Poppit");
        jButtonMePlay.setActionCommand("startnew");
        jButtonMePlay.setPreferredSize(new java.awt.Dimension(181, 23));
        jButtonMePlay.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonMePlayActionPerformed(evt);
            }
        });

        jButtonComputerPlay.setText("Have the computer play Poppit");
        jButtonComputerPlay.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonComputerPlayActionPerformed(evt);
            }
        });

        jButtonMeVSComputer.setText("Play against the computer");
        jButtonMeVSComputer.setPreferredSize(new java.awt.Dimension(181, 23));

        org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()
                .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(org.jdesktop.layout.GroupLayout.TRAILING, jButtonMeVSComputer, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(jButtonComputerPlay)
                    .add(jButtonMePlay, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );

        layout.linkSize(new java.awt.Component[] {jButtonComputerPlay, jButtonMePlay, jButtonMeVSComputer}, org.jdesktop.layout.GroupLayout.HORIZONTAL);

        layout.setVerticalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(layout.createSequentialGroup()
                .add(20, 20, 20)
                .add(jButtonMePlay, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jButtonComputerPlay)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jButtonMeVSComputer, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        layout.linkSize(new java.awt.Component[] {jButtonComputerPlay, jButtonMeVSComputer}, org.jdesktop.layout.GroupLayout.VERTICAL);

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jButtonComputerPlayActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonComputerPlayActionPerformed
        this.setVisible(false);
        this.playerType.setVisible(true);
    }//GEN-LAST:event_jButtonComputerPlayActionPerformed

    private void jButtonMePlayActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonMePlayActionPerformed
        this.gameType.gameType = "human";
        this.setVisible(false);
        this.gameType.setVisible(true);
    }//GEN-LAST:event_jButtonMePlayActionPerformed
    
    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new Start().setVisible(true);
            }
        });
    }
    
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jButtonComputerPlay;
    private javax.swing.JButton jButtonMePlay;
    private javax.swing.JButton jButtonMeVSComputer;
    // End of variables declaration//GEN-END:variables
    public GameType gameType = new GameType(this);
    public Game gameForm = new Game(this);
    public GameInterface aGame = new GameInterface();
    public NewGPPlayer gpPlayer = new NewGPPlayer(this);
    public NewSearchPlayer searchPlayer = new NewSearchPlayer(this);
    public PlayerType playerType = new PlayerType(this);
    
}
